<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Test device</title>
</head>
<body onload="onload()">
<script>
    function onload() {
        var userAgent = navigator.userAgent;
        var isIPadPro = /Macintosh/.test(userAgent) && (navigator.maxTouchPoints || "ontouchend" in document);
        var ipad = /ipad/i.test(userAgent) || isIPadPro;
        var isMobile = ipad || /iphone|ipod|android/i.test(userAgent);

        document.write(isMobile ? "当前访问mobile设备！<br>" : "当前是desktop设备！");

        if (ipad) {
            document.write("该设备是Ipad！");
        }
    }


</script>
</body>
</html>